/* static/css/admin_custom.css */
/* 更丰富的 Django Admin 主题配置 */

/* 1. 全局字体和背景 */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif !important;
  background-color: #f8f9fa !important;
}

/* 2. 顶部导航栏 (Header) */
#header {
  background: linear-gradient(
    135deg,
    #007bff,
    #0056b3
  ) !important; /* 深蓝色渐变 */
  color: white !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 12px 15px;
}

#branding h1 {
  margin: 0;
  font-size: 1.5em;
  font-weight: 500;
}
#branding h1 a:link,
#branding h1 a:visited {
  color: white !important;
  text-decoration: none;
}
#branding h1 a:hover {
  text-decoration: underline;
}

/* 3. 侧边栏 (Sidebar) */
#content-related,
#nav-sidebar {
  background-color: #ffffff !important;
  border-right: 1px solid #e9ecef;
}
#nav-sidebar .module {
  margin-bottom: 10px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 侧边栏模块标题 */
#nav-sidebar .module h2,
#nav-sidebar .module caption {
  background: linear-gradient(
    135deg,
    #28a745,
    #20c997
  ) !important; /* 绿色到青色渐变 */
  color: white !important;
  padding: 10px 15px;
  font-size: 0.95em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 侧边栏链接 */
#nav-sidebar ul li a:link,
#nav-sidebar ul li a:visited {
  color: #1a1a1a !important;
  padding: 8px 15px;
  display: block;
  border-bottom: 1px solid #f1f1f1;
  transition: all 0.2s ease;
}
#nav-sidebar ul li a:hover {
  background-color: #e3f2fd !important;
  color: #0d6efd !important;
  padding-left: 18px;
}
#nav-sidebar ul li.selected a:link,
#nav-sidebar ul li.selected a:visited {
  background-color: #d1ecf1 !important;
  font-weight: 600;
}

/* 4. 主要内容区域 (Content) */
#content {
  background-color: #ffffff !important;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin: 20px;
  padding: 20px;
}

/* 内容标题 */
#content h1,
#content h2 {
  color: #343a40;
  border-bottom: 2px solid #007bff;
  padding-bottom: 8px;
  margin-bottom: 20px;
  font-weight: 500;
}

/* 5. 按钮样式 (Actions & Form Buttons) */
input[type="submit"],
.button,
.aligned .default {
  background: linear-gradient(135deg, #007bff, #0056b3) !important;
  border: none !important;
  color: white !important;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  font-size: 0.9em !important;
  font-weight: 500 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
  transition: all 0.2s ease;
}
input[type="submit"]:hover,
.button:hover,
.aligned .default:hover {
  background: linear-gradient(135deg, #0056b3, #004085) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
}

/* 删除确认按钮 (红色警示) */
.deletelink {
  background: linear-gradient(135deg, #dc3545, #c82333) !important;
  border: none !important;
}
.deletelink:hover {
  background: linear-gradient(135deg, #c82333, #bd2130) !important;
}

/* 保存并继续编辑等次要按钮 */
input[type="submit"].default[name="_continue"],
input[type="submit"][name="_addanother"] {
  background: linear-gradient(135deg, #6c757d, #5a6268) !important;
}
input[type="submit"].default[name="_continue"]:hover,
input[type="submit"][name="_addanother"]:hover {
  background: linear-gradient(135deg, #5a6268, #4e555b) !important;
}

/* 6. 表格样式 (List Views) */
table thead th {
  background: #e9ecef !important;
  color: #495057 !important;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6 !important;
}
table tbody tr:nth-child(even) {
  background-color: #f8f9fa !important;
}
table tbody tr:hover {
  background-color: #e3f2fd !important;
  transition: background-color 0.1s ease;
}

/* 操作列图标按钮 */
table .field-actions a,
table .actions-cell a {
  margin: 0 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.85em;
}
table .field-actions a:link,
table .field-actions a:visited,
table .actions-cell a:link,
table .actions-cell a:visited {
  color: #fff !important;
  text-decoration: none;
}
/* 编辑图标 - 蓝色 */
table .field-actions a[href*="/change/"],
table .actions-cell a[href*="/change/"] {
  background-color: #007bff !important;
}
/* 查看图标 - 灰色 */
table .field-actions a[href*="/history/"],
table .actions-cell a[href*="/history/"] {
  background-color: #6c757d !important;
}
/* 删除图标 - 红色 */
table .field-actions a[href*="/delete/"],
table .actions-cell a[href*="/delete/"] {
  background-color: #dc3545 !important;
}

/* 7. 表单字段样式 */
.form-row {
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 0;
  padding: 12px 0;
  background-color: #fcfcfc;
}
.form-row:last-child {
  border-bottom: none;
}
.form-row label {
  font-weight: 500;
  color: #495057;
}
.form-row input,
.form-row textarea,
.form-row select {
  border: 1px solid #ced4da !important;
  border-radius: 4px !important;
  padding: 6px 10px !important;
  transition: border-color 0.2s ease;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  border-color: #007bff !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25) !important;
}

/* 错误消息 */
.errornote {
  background-color: #f8d7da !important;
  border-color: #f5c6cb !important;
  color: #721c24 !important;
  border-radius: 4px !important;
}
ul.errorlist {
  background-color: #fff3cd !important;
  border-color: #ffeaa7 !important;
  color: #856404 !important;
  border-radius: 4px !important;
  padding: 10px;
}

/* 8. 消息提示 (Success, Info, Warning) */
.message.warning {
  background-color: #fff3cd !important;
  border-left-color: #ffc107 !important;
}
.message.success,
.message.info {
  border-left-color: #28a745 !important;
}
.message.error {
  border-left-color: #dc3545 !important;
}

/* 9. 响应式优化 */
@media (max-width: 768px) {
  #header {
    padding: 10px;
  }
  #content {
    margin: 10px;
    padding: 15px;
  }
  body {
    font-size: 14px;
  }
}
